package com.gzz.orchid.common.webmvc.support.limiter.manager;

import lombok.extern.slf4j.Slf4j;

/**
 * @author higmd
 */
@Slf4j
public class GuavaLimitManager implements ILimiterManager {
    //private final Map<String, RateLimiter> limiterMap = new ConcurrentMap<>();

    @Override
    public boolean tryAccess(Limiter limiter) {
        //        RateLimiter rateLimiter = getRateLimiter(limiter);
        //        if (rateLimiter == null) {
        //            return false;
        //        }

        //     boolean access = rateLimiter.tryAcquire(1,100, TimeUnit.MILLISECONDS);
        boolean access = true;
        log.info("{} access :{}", limiter.getKey(), access);

        return access;
    }
}